<div class="row">
	<div class="col-md-12">
		<ol class="breadcrumb">
			<li>
				<a href="#" onclick="toHome()">
					主页
				</a>
			</li>
			<li>
				<a href="#" class="toList" onclick="toUserManage()">
					用户列表
				</a>
			</li>
			<li class="active">
				添加用户
			</li>
		</ol>
	</div>
</div>
<form role="form" class="form-horizontal">
	<div class="row page-cont">
		<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 cont-top">
			<div class="panel panel-white">
				<div class="panel-heading">
					<h4 class="panel-title">
						<span class="title-text">添加用户</span>
					</h4>
					<div class="panel-tools">
						<div class="dropdown">
							<a data-toggle="dropdown" class="btn btn-xs dropdown-toggle btn-transparent-grey">
								<i class="fa fa-cog"></i>
							</a>
							<ul class="dropdown-menu dropdown-light pull-right" role="menu">
								<li>
									<a class="panel-collapse collapses" href="#"><i class="fa fa-angle-up"></i> <span>折叠</span> </a>
								</li>
								<li>
									<a class="panel-expand" href="#">
										<i class="fa fa-expand"></i> <span>全屏</span>
									</a>
								</li>
							</ul>
						</div>
						<a class="btn btn-xs btn-link panel-close" href="#">
							<i class="fa fa-times"></i>
						</a>
					</div>
				</div>
				<div class="panel-body">
					<div class="body-cont">
						<div class="newCard">
						  	<div class="form-group panel-cont">
							    <label class="col-sm-2 control-label">部门</label>
							    <div class="col-sm-5">
							      <input type="text" class="form-control" />
							    </div>
						  		<div class="col-sm-3">
						  			<button type="button" class="btn btn-blue department-btn" data-target=".department-select" data-toggle="modal">选择</button>
						  		</div>
						  	</div>
						  	<div class="form-group panel-cont">
							    <label class="col-sm-2 control-label">岗位</label>
							    <div class="col-sm-5">
									<input type="text" class="form-control" />
							    </div>
						  		<div class="col-sm-3">
						  			<button type="button" class="btn btn-blue station-btn" data-target=".department-select" data-toggle="modal">选择</button>
						  		</div>
						  	</div>
							<div class="form-group panel-cont">
							    <label class="col-sm-2 control-label">数据权限</label>
							    <div class="col-sm-5">
									<input type="text" class="form-control" />
							    </div>
						  		<div class="col-sm-3">
						  			<button type="button" class="btn btn-blue power-btn" data-target=".department-select" data-toggle="modal">选择</button>
						  		</div>
						  	</div>	
						  	<div class="form-group panel-cont">
							    <label class="col-sm-2 control-label">身份证</label>
							    <div class="col-sm-5">
							      <input type="text" class="form-control" />
							    </div>
								<span class="col-sm-4 tips">
							    	<i class="fa fa-info-circle"></i>
							    	15-18位字母数字
							    </span>							    
						  	</div>
						  	<div class="form-group panel-cont">
							    <label class="col-sm-2 control-label">昵称</label>
							    <div class="col-sm-5">
							      	<input type="text" class="form-control" />
							    </div>
							    <span class="col-sm-4 tips">
							    	<i class="fa fa-info-circle"></i>
							    	2-10位任意字符 
							    </span>
						  	</div>
						  	<div class="form-group panel-cont">
							    <label class="col-sm-2 control-label">账号</label>
							    <div class="col-sm-5">
							      	<input type="text" class="form-control" />
							    </div>
							    <span class="col-sm-4 tips">
							    	<i class="fa fa-info-circle"></i>
							    	5-16位字母数字
							    </span>
						  	</div>
						  	<div class="form-group panel-cont">
							    <label class="col-sm-2 control-label">密码</label>
							    <div class="col-sm-5">
							      <input type="text"  class="form-control" />
							    </div>
							    <span class="col-sm-4 tips">
							    	<i class="fa fa-info-circle"></i>
							    	6-18位字母数字 
							    </span>
						  	</div>
							<div class="form-group panel-cont">
							    <label class="col-sm-2 control-label">邮箱</label>
							    <div class="col-sm-5">
							      <input type="text"  class="form-control" />
							    </div>
							    <span class="col-sm-4 tips">
							    	<i class="fa fa-info-circle"></i>
							    	6-30位邮箱规则  
							    </span>
						  	</div>	
							<div class="form-group panel-cont">
							    <label class="col-sm-2 control-label">手机</label>
							    <div class="col-sm-5">
							      <input type="text"  class="form-control" />
							    </div>
							    <span class="col-sm-4 tips">
							    	<i class="fa fa-info-circle"></i>
							    	11位数字 
							    </span>
						  	</div>
							<div class="form-group panel-cont">
							    <label class="col-sm-2 control-label">电话</label>
							    <div class="col-sm-5">
							      <input type="text"  class="form-control" />
							    </div>
							    <span class="col-sm-4 tips">
							    	<i class="fa fa-info-circle"></i>
							    	5-20位 
							    </span>
						  	</div>	
							<div class="form-group panel-cont">
							    <label class="col-sm-2 control-label">QQ</label>
							    <div class="col-sm-5">
							      <input type="text"  class="form-control" />
							    </div>
							    <span class="col-sm-4 tips">
							    	<i class="fa fa-info-circle"></i>
							    	5-20位数字  
							    </span>
						  	</div>							  	
							<div class="form-group panel-cont">
							    <label class="col-sm-2 control-label">生日</label>
							    <div class="col-sm-5">
							      <input type="text"  class="form-control birthday" />
							    </div>
						  	</div>							  						  							  						  	
						</div>						
					</div>
				  	<div class="form-group panel-btn">
				  		<div class="col-sm-2 col-sm-offset-3">
				  			<!-- <button type="button" class="btn btn-green next-btn">下一个</i></button> -->
				  			<button type="button" class="btn btn-danger submit-btn">提交&nbsp;<i class="fa fa-arrow-circle-right"></i></button>
				  		</div>
				  	</div>
				</div>
			</div>
		</div>
	</div>
</form>


<!-- 选择弹框 -->
<div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" class="modal department-select fade" id="department-select">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button aria-hidden="true" data-dismiss="modal" class="close" type="button">
					×
				</button>
				<h3 id="myModalLabel" class="modal-title">部门单选</h3>
			</div>
			<div class="modal-body">
				<ul id="zTreeContent" class="ztree"></ul>
			</div>
			<div class="modal-footer">
				<button data-dismiss="modal" class="btn btn-default" type="button">
					关闭
				</button>
				<button class="btn btn-primary" id="edit-pwd" type="button">
					确认
				</button>
			</div>
		</div>
		<!-- /.modal-content -->
	</div>
	<!-- /.modal-dialog -->
</div>
<script>
	

	/**********************************************变量**********************************************/
	var token = MXCookie.get("token",token);  // 登陆token;
	
	/**********************************************事件**********************************************/
	datePicker($(".birthday"));  // 生日
	// 提交
	$(".submit-btn").click(function(){
		// if(msgCheck()){
		// 	addCoupon();
		// }
	});


	// ------- 文件树开始-------- //
	var setting = {
			check: {
				enable: true,
				chkStyle: "radio",
				radioType: "level"
			},
			data: {
				simpleData: {
					enable: true
				}
			}
		};

	var zNodes = [];
	var zNodes1 =[
		{ id:1, pId:0, name:"公司部门组织机构", open:true, icon:"assets/plugins/zTree_v3/css/zTreeStyle/img/diy/1_open.png"},
		{ id:11, pId:1, name:"系统平台部",open:true, icon:"assets/plugins/zTree_v3/css/zTreeStyle/img/diy/2.png"},
		{ id:111, pId:11, name:"运维部",open:true, icon:"assets/plugins/zTree_v3/css/zTreeStyle/img/diy/3.png"},

		{ id:12, pId:1, name:"测试部门",open:true, icon:"assets/plugins/zTree_v3/css/zTreeStyle/img/diy/4.png"},
		{ id:121, pId:12, name:"平台组", icon:"assets/plugins/zTree_v3/css/zTreeStyle/img/diy/5.png"},
		{ id:121, pId:12, name:"测试左端", icon:"assets/plugins/zTree_v3/css/zTreeStyle/img/diy/6.png"},
	];	

	var zNodes2 =[
		{ id:1, pId:0, name:"岗位组织机构", open:true, icon:"assets/plugins/zTree_v3/css/zTreeStyle/img/diy/1_open.png"},
		{ id:11, pId:1, name:"研发经理",open:true, icon:"assets/plugins/zTree_v3/css/zTreeStyle/img/diy/2.png"},
		{ id:12, pId:1, name:"应用经理",open:true, icon:"assets/plugins/zTree_v3/css/zTreeStyle/img/diy/2.png"},
		{ id:121, pId:11, name:"应用java",open:true, icon:"assets/plugins/zTree_v3/css/zTreeStyle/img/diy/2.png"},
		{ id:122, pId:11, name:"应用c++",open:true, icon:"assets/plugins/zTree_v3/css/zTreeStyle/img/diy/2.png"},

		{ id:13, pId:1, name:"人事经理",open:true, icon:"assets/plugins/zTree_v3/css/zTreeStyle/img/diy/2.png"},
		{ id:14, pId:1, name:"行政经理",open:true, icon:"assets/plugins/zTree_v3/css/zTreeStyle/img/diy/2.png"},
		{ id:15, pId:1, name:"测试助理左端",open:true, icon:"assets/plugins/zTree_v3/css/zTreeStyle/img/diy/2.png"},
		{ id:16, pId:1, name:"财务经理",open:true, icon:"assets/plugins/zTree_v3/css/zTreeStyle/img/diy/2.png"},
		{ id:17, pId:1, name:"测试经理111",open:true, icon:"assets/plugins/zTree_v3/css/zTreeStyle/img/diy/2.png"},
	];	

	var zNodes3 =[
		{ id:1, pId:0, name:"公司部门组织机构3", open:true, icon:"assets/plugins/zTree_v3/css/zTreeStyle/img/diy/1_open.png"},
		{ id:11, pId:1, name:"系统平台部",open:true, icon:"assets/plugins/zTree_v3/css/zTreeStyle/img/diy/2.png"},
		{ id:111, pId:11, name:"运维部", icon:"assets/plugins/zTree_v3/css/zTreeStyle/img/diy/3.png"},
		{ id:12, pId:1, name:"测试部门",open:true, icon:"assets/plugins/zTree_v3/css/zTreeStyle/img/diy/4.png"},
		{ id:121, pId:12, name:"平台组", icon:"assets/plugins/zTree_v3/css/zTreeStyle/img/diy/5.png"},
		{ id:121, pId:12, name:"测试左端", icon:"assets/plugins/zTree_v3/css/zTreeStyle/img/diy/6.png"},
	];				
		
	var code;		
	function setCheck() {
		var type = $("#level").attr("checked")? "level":"all";
		setting.check.radioType = type;
		showCode('setting.check.radioType = "' + type + '";');
		$.fn.zTree.init($("#zTreeContent"), setting, zNodes);
	}
	function showCode(str) {
		if (!code) code = $("#code");
		code.empty();
		code.append("<li>"+str+"</li>");
	}

	function getModle() {
		setCheck();			
		$("#level").bind("change", setCheck);
		$("#all").bind("change", setCheck);				
	}	
	function setModle(tag,data,type){
		tag.click(function(){
			$("#department-select").attr("data-type",type);
			zNodes = data;
			getModle();	
		});		
	}
	setModle($(".department-btn"),zNodes1,"department");
	setModle($(".station-btn"),zNodes2,"station");
	setModle($(".power-btn"),zNodes3,"power");
	// ------- 文件树结束-------- //
	

	/**********************************************函数**********************************************/

	// 信息验证
	function msgCheck(){
		if($(".couponName").val() == ""){
			tips("请填写优惠券名称");
			$(this).focus();
			return false;
		}else if($(".couponIntro").val() == ""){
			tips("请填写优惠券介绍");
			$(this).focus();
			return false;
		}else if($(".startDate").val() == ""){
			tips("请填选择开始时间");
			$(this).focus();
			return false;
		}else if($(".endtDate").val() == ""){
			tips("请填选择结束时间");
			$(this).focus();
			return false;
		}else if($(".maxPrice").val() == ""){
			tips("请填写最大价格");
			$(this).focus();
			return false;
		}else{
			return true;
		}
	}

	// 新增用户
	function addUser(){
		
	}
	
</script>
